package com.neusoft.utils;

import java.util.ArrayList;
import java.util.List;

public class Pages {
	
	private int currenPage = 1;//当前的页码
	private int pageSize = 3;//每页显示的记录数
	private int totalCount;//总记录数
	
	private int prePage;//上一页
	private int nextPage;//下一页
	private int totalPage;//总页数
	
	private List<Integer> pageList;//页数的list列表

	public int getCurrenPage() {
		return currenPage;
	}

	public void setCurrenPage(int currenPage) {
		this.currenPage = currenPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	
	public int getTotalCount() {
		
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	//获取上一页的get方法
	public int getPrePage() {
		if(getCurrenPage()>1) {
			prePage = getCurrenPage()-1;
		}else {
			prePage = 1;
		}
		return prePage;
	}

	public void setPrePage(int prePage) {
		this.prePage = prePage;
	}

	//获取下一页的get方法
	public int getNextPage() {
		if(getCurrenPage()<getTotalPage()) {
			nextPage = getCurrenPage()+1;
		}else {
			nextPage = getTotalPage();
		}
		return nextPage;
	}

	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}

	//获取总页数的get方法
	public int getTotalPage() {
		if(getTotalCount()%getPageSize() == 0) {
			totalPage = getTotalCount()/getPageSize();
		}else { 
			totalPage = getTotalCount()/getPageSize() + 1;
		}
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	//获取总页码的list
	public List<Integer> getPageList() {
		pageList = new ArrayList<Integer>();
		for(int i=0;i<getTotalPage();i++) {
			pageList.add(i+1);
		}
		return pageList;
	}

	public void setPageList(List<Integer> pageList) {
		this.pageList = pageList;
	}
	
	
	
}
